@(page: models.cms.PageDto, searchType: String)

<script type="text/javascript">
$(function() {  
	$('#search_results').hide();
    $(".button").click(function() {  
        alert($("input[name^='search_facets']").serializeArray());
    	var facets = $("input[name^='search_facets']").serializeArray();
        var word = $("input#search_field").val();
        var urlString = "";
        if(facets == undefined){
          facets = "*:*";
        }
        if(word == undefined || word==""){
           urlString = '@routes.Search.findByFacet(searchType,"")' + facets  ;  
        } else {
           urlString = '@routes.Search.find(searchType,"")' + word +  "/facets/" + facets  ;  
        } 
  	    alert(urlString);
  	    $.ajax({  
  	      type: "GET",  
  	      url: urlString,  
  	      success: function(data) {  
  	        $('#search_results').html(data)
  	        .hide()
  	        .fadeIn(1500, function() {  
  	          $('#search_results');  
  	        });  
  	      }  
  	    });  
  	    return false;  
    });  
  });
</script>
    
<div id="search">
	<form action="" method="GET" name="search_form">
		<fieldset>
			<label id="search_field_label" for="search_field">Mots Clé</label>
			<input type="text" name="search_field" id="search_field" value="" class="txt-input"/>
			<br/>
			<input type="submit" class="button" id="search_submit" value="Trouve"/>	
		</fieldset>
		<div id='search_results'></div>
	</form>
</div> 
